package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Administrator
 * Date: 2023-07-02
 * Time: 17:11
 */
interface Ishape{
    void draw();
    default public void draw4(){
        System.out.println("默认default方法");
    }
}

class Cycle implements Ishape{
    @Override
    public void draw() {
        System.out.println("○");
    }

    @Override
    public void draw4() {
        System.out.println("重写默认default方法");
    }
    /*    @Override
    public void draw(){
        System.out.println("○");
    }*/
}

class Rect implements Ishape{
    @Override
    public void draw(){
        System.out.println("矩形");
    }
}
public class Test {
    public static void drawMap(Ishape ishape){
        ishape.draw();
    }
    public static void main(String[] args) {
        drawMap(new Cycle());
        drawMap(new Rect());
    }
}
